* This file provides the code for the numerical results presented in
*	Supplementary Material

set more off

use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace
svyset [pw=VCF0009z]

cd "/Users/jrthornton/Desktop/Replication"	
log using "Tables for Supplemental Online Appendix" , text replace

************************
***** APPENDICIES ******
************************

* Table B1
corr soph_irt soph_irt_alt soph_irt_alt2 d1 sophistication



* TABLE C1
est drop _all
svy: reg equality_irt c.soph_irt##i.party ideology pidi age income educ i.sex i.race if year>2005
margins,  dydx(soph_irt) at(party=(0(1)2)) post
est store pooled 


* TABLE E1
	* Main models with alternative measure of sophisticaction (replaces interviewer assessment with knowledge of House
	* Interviewer assessment only available for face-to-face sample

reg equality_irt c.soph_irt_alt pidi i.sex income age educ i.race ideology if year>2005 & pid<4
reg black_issues_irt ib1.race##c.soph_irt_alt pidi age income educ sex equality_irt ideology if year>2005 & pid<4
reg welfare_support_irt c.income##c.soph_irt_alt pidi age  educ i.race sex equality_irt ideology if year>2005 & pid<4
use "/Users/jrthornton/Desktop/Replication/gay_rights.dta"
reg gay_irt c.soph_alt i.race income equality_irt pidi ideo age educ sex if party==0 & gay==0
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace
	svyset [pw=VCF0009z]

* TABLE E2 (FIX THIS in the TEXT)
* Main models with weighting:
svy: reg equality_irt c.soph_irt pidi i.sex income age educ i.race ideology  if year>2005 & pid<4
svy: reg black_issues_irt ib1.race##c.soph_irt pidi age income educ sex equality_irt ideology if year>2005 & pid<4
svy: reg welfare_support_irt c.income##c.soph_irt pidi age  educ i.race sex equality_irt ideology if year>2005 & pid<4
use "/Users/jrthornton/Desktop/Replication/gay_rights.dta"
	svyset [pw=w]
svy: reg gay_irt c.soph_irt pidi age income educ i.sex i.race equality_irt  ideology   if party==0 & year>2005
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace
	svyset [pw=VCF0009z]

* TABLE E3
* Main models without pidi and ideology 
reg equality_irt c.soph_irt i.sex income age educ i.race  if year>2005 & pid<4
reg black_issues_irt ib1.race##c.soph_irt age income educ sex equality_irt if year>2005 & pid<4 
reg welfare_support_irt c.income##c.soph_irt age  educ i.race sex equality_irt if year>2005 & pid<4
use "/Users/jrthornton/Desktop/Replication/gay_rights.dta"
reg gay_irt c.soph_irt i.race income equality_irt age educ sex if party==0 & gay==0
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace

* Table E4
* Replication of main models using 2000-2016
run "/Users/jrthornton/Desktop/Replication/2000-2016.do"
reg equality_irt c.soph_irt pidi i.sex income age educ i.race ideology  if year>1999 & pid<4
reg black_issues_irt ib1.race##c.soph_irt pidi age income educ sex equality_irt ideology if year>1999 & pid<4 
reg welfare_support_irt c.income##c.soph_irt pidi age  educ i.race sex equality_irt ideology if year>1999 & pid<4
reg gay_irt c.soph_irt pidi age  educ i.race sex equality_irt ideology if year>1999 & pid<4
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace

* Table E5
* Fixed effects 
set more off
reg equality_irt c.soph_irt pidi ideology i.sex income age educ i.race  i.year if year>2005 & pid<4
reg black_issues_irt ib1.race##c.soph_irt equality_irt pidi age income educ sex  ideology i.year if year>2005 & pid<4 
reg welfare_support_irt c.income##c.soph_irt equality_irt pidi ideology age  educ i.race sex  i.year if year>2005 & pid<4
use "/Users/jrthornton/Desktop/Replication/gay_rights.dta"
reg gay_irt c.soph_irt i.race income equality_irt pidi ideology age educ i.sex i.year if party==0 & gay==0
reg gay_irt c.soph_irt i.race income equality_irt pidi ideology age educ i.sex i.year if party==0 & gay==0
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace

* TABLE E6
* Predicting Egalitarianism Among Democrats, 2008-2016 ANES Accounting for DIF
reg equality_dif c.soph_irt pidi i.sex income age educ i.race ideology  if year>2005 & pid<4

set more off

* TABLE E7
* Aid to blacks & aid to poor among whites controlling for racial resentment
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace
	svyset [pw=VCF0009z]
reg black_issues_irt ib1.race##c.soph_irt pidi age income educ sex equality_irt ideology racial_resentment_irt if year>2005 & pid<4 & race==1
reg welfare_support_irt c.soph_irt##c.income pidi age  educ i.race sex equality_irt ideology racial_resentment_irt if year>2005 & pid<4 & pid<4 & race==1


* Table E8
* Aid to Blacks and Aid to the Poor Controlling for Alternative Measures of Racial Prejudice, Whites and Latinos Only Mode
reg black_issues_irt ib1.race c.soph_irt pidi age income educ sex equality_irt ideology prejudice if year>2005 & pid<4 & race!=2 & race!=4
reg black_issues_irt ib1.race c.soph_irt pidi age income educ sex equality_irt ideology diftherm if year>2005 & pid<4 & race!=2 & race!=4



* Table E9
* Mediation Analysis of Support for Gays Rights Policies
use "/Users/jrthornton/Desktop/Replication/gay_rights.dta" , replace
# delimit ;
	sem 
	(therm_gays <- soph_irt income equality_irt pidi ideo age educ sex 
		black latinx other) 
	(gay_irt <- therm_gays soph_irt income equality_irt pidi ideo age educ 
		sex  black latinx other) 
	if party==0 & gay==0
	,
	vce(bootstrap,reps(2000)) 
	;
# delimit cr
estat teffects
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace

* Table E10
* Mediation Analysis of Support for Aid to Blacks/Affirmative Action, 2008-2016 ANES
# delimit ;
	sem 
	(equality_irt <- 		soph_irt pidi sex income age educ ideology) 
	(black_issues_irt <- 	soph_irt pidi sex income age educ ideology equality_irt) 
	if party==0 & race==1 & year>2005
	,
	vce(bootstrap,reps(2000)) 
	;
# delimit cr
estat teffects

* Table E11
* Mediation Analysis of Support for Welfare/Aid to the Poor
# delimit ;
	sem 
	(equality_irt <- 		soph_irt pidi sex income age educ ideology) 
	(welfare_support_irt <- 	soph_irt pidi sex income age educ ideology equality_irt) 
	if party==0 & income>3 & year>2005
	,
	vce(bootstrap,reps(2000)) 
;
# delimit cr

* Table E12
reg equality_irt c.info_irt pidi i.sex income age educ i.race ideology  if year>2005 & pid<4	
reg black_issues_irt ib1.race##c.info_irt pidi age income educ sex equality_irt ideology if year>2005 & pid<4 
reg welfare_support_irt c.income##c.info_irt pidi age  educ i.race sex equality_irt ideology if year>2005 & pid<4
reg gay_irt c.info_irt pidi age income educ i.sex i.race equality_irt  ideology   if pid<4 & year>2005


* Table F1
* Predicted Attitudes Toward Social Security Among Republicans
reg social_security c.income c.age##c.soph_irt pidi educ ///
	i.race sex equality_irt ideology if year>2005 & pid>4

* Table F2
* Predicting Attitudes Toward Government Services Spendin
reg selfservice c.income##c.soph_irt pidi age  educ i.race sex equality_irt ideology if year>2005 & pid<4
reg selfservice c.income##c.soph_irt pidi age  educ i.race sex equality_irt ideology if year>2005 & pid>4

* Table F3
reg tradvalues c.soph_irt pidi i.sex income age educ i.race ideology church evangelical2 if year>2005 & pid>4

* Table G1
run "/Users/jrthornton/Desktop/Replication/2016 gender.do" // codes gender items for 2016 (see "2016 gener.do" for details)
reg  women_issues  c.sex##c.soph_irt i.race pidi age income educ equality_irt ideology if party==0
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace

* Table H1
reg black_issues_irt ib1.race##c.soph_irt##c.equality_irt pidi age income ///
	educ sex equality_irt ideology if year>2005 & pid<4 
reg black_issues_irt ib1.race##c.equality_irt ib1.race##c.soph_irt pidi age ///
	income educ sex  ideology if year>2005 & pid<4 


* Table H2
reg welfare_support_irt c.income##c.equality_irt c.income##c.soph_irt pidi age ///
	educ i.race sex  ideology if year>2005 & pid<4
reg welfare_support_irt c.income##c.soph_irt##c.equality_irt pidi age  educ ///
	i.race sex equality_irt ideology if year>2005 & pid<4

* Table H3
use "/Users/jrthornton/Desktop/Replication/gay_rights.dta" , replace
reg gay_irt c.soph_irt##c.equality_irt i.race income  pidi ideo age educ sex if party==0 & gay==0
use "/Users/jrthornton/Desktop/Replication/Cumulative file coded.dta" , replace


* TABLE I1
reg environment2 c.soph_irt pidi age income educ sex equality_irt ideology i.race if year>2005 & pid<4 & VCF9047 <7
reg schools2 c.soph_irt pidi age income educ sex equality_irt ideology i.race  if year>2005 & pid<4 & VCF9047 <7
reg selfinsure2 c.soph_irt i.race pidi age income educ sex equality_irt i.race  ideology if year>2005 & pid<4 
reg selfservice2 c.soph_irt i.race pidi age income educ sex equality_irt i.race  ideology if year>2005 & pid<4 
reg guarjobs2 c.soph_irt pidi age income educ sex equality_irt ideology i.race  if year>2005 & pid<4 & VCF9047 <7
reg childcare2 c.soph_irt pidi age income educ sex equality_irt ideology i.race  if year>2005 & pid<4 & VCF9047 <7


* TABLE I2
ologit environment c.soph_irt pidi age income educ sex equality_irt ideology i.race if year>2005 & pid<4 & VCF9047 <7
ologit schools c.soph_irt pidi age income educ sex equality_irt ideology i.race  if year>2005 & pid<4 & VCF9047 <7
ologit selfinsure c.soph_irt i.race pidi age income educ sex equality_irt i.race  ideology if year>2005 & pid<4 
ologit selfservice c.soph_irt i.race pidi age income educ sex equality_irt i.race  ideology if year>2005 & pid<4 
ologit guarjobs c.soph_irt pidi age income educ sex equality_irt ideology i.race  if year>2005 & pid<4 & VCF9047 <7
ologit childcare c.soph_irt pidi age income educ sex equality_irt ideology i.race  if year>2005 & pid<4 & VCF9047 <7

log close

